# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=cvs
pkgver=1.12.13
pkgrel=1
pkgdesc="Concurrent Versions System"
url="https://www.nongnu.org/cvs/"
arch="all"
license="GPL-2.0-or-later"
options="!check" # Tests fail - src/lib/test-getdate.sh
makedepends="
	autoconf
	automake
	gettext-dev
	libbsd-dev
	texinfo
	zlib-dev
"
subpackages="$pkgname-doc"
source="https://ftp.gnu.org/non-gnu/cvs/source/feature/$pkgver/cvs-$pkgver.tar.gz
	cvs_1.12.13+real-26.patch
	install-sh.patch
	mktime-configure.patch
	getcwd.patch
	add-libbsd.patch
	"

# secfixes:
#   1.12.12-r0:
#     - CVE-2010-3846
#     - CVE-2012-0804
#     - CVE-2017-12836
prepare() {
	default_prepare
	update_config_sub
	autoreconf -fi
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-external-zlib \
		--with-tmpdir=/tmp
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
acd658b7ffa29a67e33f294073a0f80a27aa4e19dc2185cfa43f862d34e511bcf9802012b8e6957f82c7532fdabbb058b33686e0e6046cdd1f1aa9af619e92e9  cvs-1.12.13.tar.gz
510a8a3ed392108f360f3477af45f863ea3603b8c3f90504dfc018e3ef5ed79e69fcd3e38c82b46061cc82a53859d8ab209ae6f8ee07134f7db98bc3f1e38f06  cvs_1.12.13+real-26.patch
44e0b683f8178804d029957e78af046197142181564bfb0209da2682f9817e6c661a9e0dd390d236c9ebdc937df920269e708bb7d7c84ca942341fd413a1b265  install-sh.patch
a430f2659e1f96bc4ba2205567662eb5863c0c73b2e0c43eba86b23734b3874663e389e74e6011c6a0e9f4074d676adfd6c88fbe20f11ca33ba3223a93dad02c  mktime-configure.patch
99a9107603a933c164070787a3e270f8b1d82fb6930763061f019a42c0d88e4ac981941ccc0851ae051df757caef5d6c9a9e9b87d3378e7361cc78f48460f4a1  getcwd.patch
eecdd7f8a31ae63901e6b7336c7aac5827dd33ce2c80bb7d629ffb3dc65927eae75f59f6a949e290471982f22265f02eaa17febd6e6ea5f799edcfcbccd3b511  add-libbsd.patch
"
